Skip to content

Preserve spatial vector sequences in copy constructors - #299

Open
kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix/spatial-vector-copy
Open

kaushikgunasekaren wants to merge 2 commits into
rai-opensource:masterfrom
kaushikgunasekaren:fix/spatial-vector-copy

Conversation

@kaushikgunasekaren

Copy link
Copy Markdown

SpatialVelocity(existing_sequence) and the other spatial-vector constructors wrap value.A in one list entry. For a sequence, A is already a list of vectors, so the copy has length 1 and contains a nested list; indexing and printing then break. Copying an empty sequence also creates one invalid element.

Copy the source's data list instead, preserving its cardinality and individual vectors while keeping the container independent. Existing singleton and cross-subclass construction stay supported.

Validation on current master 25b19b3, Python 3.10:

  • Regression cases cover empty, singleton, two- and four-element copies of velocity, acceleration, force and momentum, plus cross-subclass copies and independent append behavior. Before the fix: 13 failing cases and 4 singleton controls passing. After: all pass.
  • Full local suite: 568 passed, 3 skipped, 115 subtests passed; 29 existing warnings. Pristine baseline: 566 passed, 3 skipped, 99 subtests passed with the same warnings.
  • Black 23.10.0, fatal-error flake8 checks on changed files, and git diff --check pass.

This does not change the Twist/SpatialVelocity conversion or operator-design questions in #257. AI assistance was used for investigation, implementation and tests. Validated locally without robot hardware.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant